// $ANTLR 3.4 C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g 2012-11-07 16:33:13
package PL.practica8;

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked"})
public class XMLParser extends Parser {
    public static final String[] tokenNames = new String[] {
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "ABRIRANGULO", "ANGULOSLASH", "ATRIBUTO", "BLANCO", "CADENA", "CERRARANGULO", "CHAR", "COMENTARIO", "DIGITO", "ID", "IGUAL", "NUEVA_LINEA", "NUMERO", "OPERADOR", "PARAM", "PARENTESIS", "SEPARADOR", "SIMBOLOS", "VALOR"
    };

    public static final int EOF=-1;
    public static final int ABRIRANGULO=4;
    public static final int ANGULOSLASH=5;
    public static final int ATRIBUTO=6;
    public static final int BLANCO=7;
    public static final int CADENA=8;
    public static final int CERRARANGULO=9;
    public static final int CHAR=10;
    public static final int COMENTARIO=11;
    public static final int DIGITO=12;
    public static final int ID=13;
    public static final int IGUAL=14;
    public static final int NUEVA_LINEA=15;
    public static final int NUMERO=16;
    public static final int OPERADOR=17;
    public static final int PARAM=18;
    public static final int PARENTESIS=19;
    public static final int SEPARADOR=20;
    public static final int SIMBOLOS=21;
    public static final int VALOR=22;

    // delegates
    public Parser[] getDelegates() {
        return new Parser[] {};
    }

    // delegators


    public XMLParser(TokenStream input) {
        this(input, new RecognizerSharedState());
    }
    public XMLParser(TokenStream input, RecognizerSharedState state) {
        super(input, state);
    }

    public String[] getTokenNames() { return XMLParser.tokenNames; }
    public String getGrammarFileName() { return "C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g"; }


    ArrayList <RecognitionException> errores = new ArrayList<RecognitionException>();

      public boolean listaVacia (){
        if (errores.isEmpty()){
          return true;
        }else
          return false;
    }

      public ArrayList getListaErrores(){return errores;}


    @Override
      public void reportError (RecognitionException e){
        System.err.println (getErrorMessage(e, getTokenNames()));
        errores.add(e);
    }






    // $ANTLR start "entrada"
    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:35:1: entrada : ( etiqueta )* ;
    public final void entrada() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:35:8: ( ( etiqueta )* )
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:35:9: ( etiqueta )*
            {
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:35:9: ( etiqueta )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0==ABRIRANGULO) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:35:9: etiqueta
            	    {
            	    pushFollow(FOLLOW_etiqueta_in_entrada46);
            	    etiqueta();

            	    state._fsp--;


            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "entrada"



    // $ANTLR start "etiqueta"
    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:37:1: etiqueta : ABRIRANGULO id1= ID ( ATRIBUTO )* CERRARANGULO elemento ANGULOSLASH id2= ID CERRARANGULO ;
    public final void etiqueta() throws RecognitionException {
        Token id1=null;
        Token id2=null;

        try {
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:38:3: ( ABRIRANGULO id1= ID ( ATRIBUTO )* CERRARANGULO elemento ANGULOSLASH id2= ID CERRARANGULO )
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:38:5: ABRIRANGULO id1= ID ( ATRIBUTO )* CERRARANGULO elemento ANGULOSLASH id2= ID CERRARANGULO
            {
            match(input,ABRIRANGULO,FOLLOW_ABRIRANGULO_in_etiqueta57); 

            id1=(Token)match(input,ID,FOLLOW_ID_in_etiqueta63); 

            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:38:26: ( ATRIBUTO )*
            loop2:
            do {
                int alt2=2;
                int LA2_0 = input.LA(1);

                if ( (LA2_0==ATRIBUTO) ) {
                    alt2=1;
                }


                switch (alt2) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:38:27: ATRIBUTO
            	    {
            	    match(input,ATRIBUTO,FOLLOW_ATRIBUTO_in_etiqueta66); 

            	    }
            	    break;

            	default :
            	    break loop2;
                }
            } while (true);


            match(input,CERRARANGULO,FOLLOW_CERRARANGULO_in_etiqueta70); 

            pushFollow(FOLLOW_elemento_in_etiqueta72);
            elemento();

            state._fsp--;


            match(input,ANGULOSLASH,FOLLOW_ANGULOSLASH_in_etiqueta74); 

            id2=(Token)match(input,ID,FOLLOW_ID_in_etiqueta80); 

            match(input,CERRARANGULO,FOLLOW_CERRARANGULO_in_etiqueta82); 

             if (!id1.getText().equals(id2.getText())) 
                System.err.println ("Error - etiqueta abierta " + id1.getText() +
                          " (linea = " + id1.getLine() + ", columna = " + id1.getCharPositionInLine() + ") " +
                                    "No concuerda con la etiqueta de cierre " + id2.getText() +
                                    " (linea = " + id2.getLine() + ", columna = " + id2.getCharPositionInLine() + ")"); 

            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "etiqueta"



    // $ANTLR start "elemento"
    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:1: elemento : ( etiqueta | VALOR )* ;
    public final void elemento() throws RecognitionException {
        try {
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:10: ( ( etiqueta | VALOR )* )
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:12: ( etiqueta | VALOR )*
            {
            // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:12: ( etiqueta | VALOR )*
            loop3:
            do {
                int alt3=3;
                int LA3_0 = input.LA(1);

                if ( (LA3_0==ABRIRANGULO) ) {
                    alt3=1;
                }
                else if ( (LA3_0==VALOR) ) {
                    alt3=2;
                }


                switch (alt3) {
            	case 1 :
            	    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:13: etiqueta
            	    {
            	    pushFollow(FOLLOW_etiqueta_in_elemento97);
            	    etiqueta();

            	    state._fsp--;


            	    }
            	    break;
            	case 2 :
            	    // C:\\Users\\Jose\\workspace\\practica8\\src\\main\\java\\PL\\practica8\\XMLParser.g:45:22: VALOR
            	    {
            	    match(input,VALOR,FOLLOW_VALOR_in_elemento99); 

            	    }
            	    break;

            	default :
            	    break loop3;
                }
            } while (true);


            }

        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return ;
    }
    // $ANTLR end "elemento"

    // Delegated rules


 

    public static final BitSet FOLLOW_etiqueta_in_entrada46 = new BitSet(new long[]{0x0000000000000012L});
    public static final BitSet FOLLOW_ABRIRANGULO_in_etiqueta57 = new BitSet(new long[]{0x0000000000002000L});
    public static final BitSet FOLLOW_ID_in_etiqueta63 = new BitSet(new long[]{0x0000000000000240L});
    public static final BitSet FOLLOW_ATRIBUTO_in_etiqueta66 = new BitSet(new long[]{0x0000000000000240L});
    public static final BitSet FOLLOW_CERRARANGULO_in_etiqueta70 = new BitSet(new long[]{0x0000000000400030L});
    public static final BitSet FOLLOW_elemento_in_etiqueta72 = new BitSet(new long[]{0x0000000000000020L});
    public static final BitSet FOLLOW_ANGULOSLASH_in_etiqueta74 = new BitSet(new long[]{0x0000000000002000L});
    public static final BitSet FOLLOW_ID_in_etiqueta80 = new BitSet(new long[]{0x0000000000000200L});
    public static final BitSet FOLLOW_CERRARANGULO_in_etiqueta82 = new BitSet(new long[]{0x0000000000000002L});
    public static final BitSet FOLLOW_etiqueta_in_elemento97 = new BitSet(new long[]{0x0000000000400012L});
    public static final BitSet FOLLOW_VALOR_in_elemento99 = new BitSet(new long[]{0x0000000000400012L});

}